package com.citcc.api.controller;

import com.citcc.api.config.Authorization;
import com.citcc.business.bean.CdzAppUser;
import com.citcc.business.bean.vo.AccountAmountMyAmountVO;
import com.citcc.business.bean.vo.AccountAmountRechargeParamVO;
import com.citcc.business.service.CdzAccountAmountService;
import com.citcc.common.msg.Response;
import com.citcc.common.utils.ResponseUtil;
import com.citcc.framework.base.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * Created by czh on 2019/5/17 11:48
 */
@Api(value = "账户余额", tags = "我的钱包")
@RestController
@RequestMapping("/accountAmount")
public class CdzAccountAmountController extends BaseController {

    @Autowired
    private CdzAccountAmountService accountAmountService;

    /**
     * 我的余额
     *
     * @param user
     * @return
     */
    @PostMapping("/v1/myAmount")
    @ApiOperation(value = "我的余额", notes = "需要在header中加入Authorization。")
    public Response<AccountAmountMyAmountVO> myAmount(@ApiIgnore @Authorization CdzAppUser user) {
        return ResponseUtil.success(accountAmountService.myAmount(user.getId()));
    }

    /**
     * 充值可选参数
     *
     * @param user
     * @return
     */
    @PostMapping("/v1/rechargeParam")
    @ApiOperation(value = "充值可选参数", notes = "需要在header中加入Authorization。")
    public Response<AccountAmountRechargeParamVO> rechargeParam(@ApiIgnore @Authorization CdzAppUser user) {
        return ResponseUtil.success(accountAmountService.rechargeParam(user.getId()));
    }
}
